"""
vad factory
"""
from common.const import VADType
from common.log import logger


def create_vad(vad_type, vad_queue, recording_callback, mute_callback):
    """
    create a vad_type instance
    :param vad_type: vad type code
    :return: vad instance
    """
    if vad_type == VADType.SILERO:
        from silero_vad.silero_vad import SileroVAD
        return SileroVAD(vad_queue, recording_callback, mute_callback)
    logger.error("not vad type!")
    raise RuntimeError
